package codename.carrot.bomberman.game.networkobjects;

import java.io.Serializable;

/**
 * Class representing an item-container which is suitable for being sent over the network<br>
 *  unlike {@link codename.carrot.bomberman.models.ItemContainer}, this class is only used for sending the level from
 *  the server to the clients
 *  
 * @author Group A4
 *
 */

public class ItemContainer implements Serializable {
	/**
	 * UID for serialization.
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * The type of item.
	 */
    private int type=-1;
    /**
     * Coordinate of the item container.
     */
    private DroidPoint droidPoint;
    /**
     * True if this item is a power up, false otherwise.
     */
    private boolean isPowerUp;
    
    /**
     * Constructs an itemcontainer at x, y coordinates in droid point.
     * @param droidPoint The coordinates to place the container.
     */
    public ItemContainer(DroidPoint droidPoint) {
        this.droidPoint = droidPoint;
    }
    
    /**
     * Sets the type of item contained in this container
     * @param type The type of item.
     * @param isPowerUp true if power-up, false if power-down
     */
    public void setType(int type, boolean isPowerUp) {
        this.type = type;
        this.isPowerUp = isPowerUp;
    }       
    
    /**
     * Returns true if this container actually has an item, false if not
     * @return true or false
     */
    public boolean hasItem() {
        return type > -1;
    }
    
    /**
     *  Returns true if there's an item in this container, and it's a power-up
     * @return isPowerUp
     */
   public boolean isPowerUp() {
       return isPowerUp;
   }
   
   /**
    * Returns the position for this itemcontainer
    * @return position
    */
   public DroidPoint getDroidPoint() {
       return droidPoint;
   }
   
   /**
    *  Returns the type of the item in this container, if no item is in the container, -1 will be returned
    * @return the type of power up/down.
    */
   public int getType() {
       return type;
   }
}
